import machine
from machine import RTC
rtc=RTC()

startTime=()
def callback(pin):

    global startTime
    startTime=rtc.datetime()
    print("start:",startTime)

def callback1(pin):
    global startTime
    endTime=rtc.datetime()
    print("end:",endTime)
    print((endTime[6]*1000000+endTime[7]-startTime[6]*1000000-startTime[7])/1000)


p25 = machine.Pin(4, machine.Pin.IN)
p25.irq(trigger=machine.Pin.IRQ_RISING, handler=callback)
p21 = machine.Pin(21, machine.Pin.IN)
p21.irq(trigger=machine.Pin.IRQ_FALLING , handler=callback1)
